package com.cz.fra.android.entity;

import com.cz.fra.android.data.FishReport.ReportTable;

import android.content.ContentValues;

public class Report implements Comparable<Report>{

	private int reportID;
	
	private String title;
	
	private String description;
	
	private String locations;
	
	private String baits;
	
	private String species;
	
	private String imgs;
	
	private int createdBy;
	
	private String createdDate;
	
	private int updatedBy;
	
	private String updatedDate;

	private int commentNo;
	
	private boolean asc;
	
	public int getCommentNo() {
		return commentNo;
	}

	public void setCommentNo(int commentNo) {
		this.commentNo = commentNo;
	}

	public int getReportID() {
		return reportID;
	}

	public void setReportID(int reportID) {
		this.reportID = reportID;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getLocations() {
		return locations;
	}

	public void setLocations(String locations) {
		this.locations = locations;
	}

	public String getBaits() {
		return baits;
	}

	public void setBaits(String baits) {
		this.baits = baits;
	}

	public String getSpecies() {
		return species;
	}

	public void setSpecies(String species) {
		this.species = species;
	}

	public String getImgs() {
		return imgs;
	}

	public void setImgs(String imgs) {
		this.imgs = imgs;
	}

	public int getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(int createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(String createdDate) {
		this.createdDate = createdDate;
	}

	public int getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(int updatedBy) {
		this.updatedBy = updatedBy;
	}

	public String getUpdatedDate() {
		return updatedDate;
	}

	public void setUpdatedDate(String updatedDate) {
		this.updatedDate = updatedDate;
	}
	
	public ContentValues instanceToCV(){
		ContentValues cv = new ContentValues();
		cv.put(ReportTable.REPORT_ID, reportID);
		cv.put(ReportTable.REPORT_TITLE, title);
		cv.put(ReportTable.REPORT_DESCRIPTION, description);
		cv.put(ReportTable.REPORT_LOCATIONS, locations);
		cv.put(ReportTable.REPORT_BAITS, baits);
		cv.put(ReportTable.REPORT_SPECIES, species);
		cv.put(ReportTable.REPORT_IMGS, imgs);
		cv.put(ReportTable.REPORT_COMMENTNO, commentNo);
		if(createdDate != null){
			cv.put(ReportTable.REPORT_CREATE_DATE, createdDate.toString());
			cv.put(ReportTable.REPORT_UPDATE_DATE, updatedDate.toString());
		}
		cv.put(ReportTable.REPORT_USER_ID, createdBy);
		return cv;
	}
	
	public String toString() {
        return "File Path: ";
    }

	@Override
	public int compareTo(Report another) {
		final int thisId = this.reportID;
		final int anotherId = another.reportID;
		int result;
		if(thisId > anotherId) result = 1;
		else if(thisId == anotherId) result = 0;
		else result = -1;
		
		//desc sort, otherwise return result
		return result * -1;
	}
}
